using System;

namespace Storage.Core
{
	internal class DeleteQuery : IStorageQuery
	{
		public DeleteQuery(Guid id)
		{
			Id = id;
		}

		public byte[] Serialize()
		{
			var serializer = new FastBinarySerializer(sizeof(byte) + 16);
			serializer.Write(StorageOpCodes.Delete).Write(Id);
			return serializer.Buffer;
		}

		public static DeleteQuery Deserialize(IBinaryDeserializer ds)
		{
			return new DeleteQuery(ds.ReadGuid());
		}

		public Guid Id{ get; private set; }
	}
}